package compile;

import java.util.Arrays;
import java.util.List;

/**
 * 语法糖
 * 1. 泛型
 * 2. 自动装箱
 * 3. for-each
 */
public class SugarDemo {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);
        int sum = 0;
        for (Integer i : list) {
            sum += i;
        }
        System.out.println(sum);
    }
}
